package com.tang.algorithm.ordinary;

import java.util.HashMap;
import java.util.Map;

/**
 * @author tlm
 * @Description
 * @date 2020/6/22 20:55 下午
 */
public class LeetCode535 {
    public static void main(String[] args) {

    }

}
 class Codec {
    Map<Integer, String> map = new HashMap<>();
    int i = 0;

    public String encode(String longUrl) {
        map.put(i, longUrl);
        return "http://tinyurl.com/" + i++;
    }

    public String decode(String shortUrl) {
        return map.get(Integer.parseInt(shortUrl.replace("http://tinyurl.com/", "")));
    }
}

